<h1 class="right">تقرير الحركه الشهريه </h1><!--<div class="h1-dot"></div>-->

<span class="left grey medium margin-left11 margin-top5"><?php echo date('g:ia d/m/Y')?></span>
<div class="clear"></div>
<div id="dashboard-container">
	<div class="apartment-filter">
    <form name="searchClient" action="monthly_report.php" method="POST" id="searchClient">
    	<table class="bookings-filter">
        <tr>
          <td style="width:20px;">شهر </td>
                  <td style="width:80px;">
                   
                    <select name="month" id="choose_month">
                      <?php 
                        for($i = 1;$i < 13;$i++)
                        {
                          
                          if(isset($month))
                          {
                            if($i == $month)
                              echo '<option selected="selected" value="'.$i.'">'.$i.'</option>';
                            else
                              echo '<option value="'.$i.'">'.$i.'</option>';
                            
                          }
                          else
                              echo '<option value="'.$i.'">'.$i.'</option>';
                        }
                      ?>
                    </select>
                  </td>
                  <td style="width:10px;">سنة </td>
                  <td style="width:70px;">
                    <select  name="year" id="choose_year">
                      <?php
                        $year = intval(date('Y', time()));
                        for($i = 1970;$i<=$year;$i++) 
                        {
                          if(isset($year))
                          {
                            if($i == $year)
                              echo '<option selected="selected" value="'.$i.'">'.$i.'</option>';
                          }
                          else if($i == $year)
                            echo '<option selected="selected" value="'.$i.'">'.$i.'</option>';
                          else
                            echo '<option value="'.$i.'">'.$i.'</option>';
                        }
                        ?>
                    </select>
                  </td>
                 <td style="width:20px;">الطابق&nbsp;:</td>
                 
                 <td style="width:50px;"><input name="floor#" type="text" class="auto-input" value="<?php if(isset($binds['floor#']) ) {echo $binds['floor#'];} ?>"/></td>
<td style="width:10px;"></td>                		 
                     <td style="width:80px;">رقم الوحدة&nbsp;:</td>
           <td style="width:50px;"><input name="room_name" type="text" class="auto-input" value="<?php if(isset($binds['room_name']) ) {echo $binds['room_name'];} ?>"/></td>

                <td></td>
                <input name="filter" class="client-id" type="hidden" value="2"/>
                <input checked='checked' class="company-select" name="check" type="hidden" value="<?php if(isset($check) ) {echo $check;} ?>"/>
                <input type="hidden" id="page" name="page" value="" />
				<td style="width:15px">
                  <input type="hidden" name="filteration" value="18"/> <!-- 11 for traffic Reposts -->
                  <a href="#"><div class="export-button">تصدير Excel</div></a>
                  
                  <input type="hidden" id="pdf_excel" name="pdf_excel" value="119"/>
                </td>
                <td style="width:15px"><a href="#"><div class="export-PDF">تصدير PDF</div></a></td>
                <td style="width:50px"><div class="search-botton">بحث</div></td>
		</tr>
      </table>
    </form >
      </div>
    <div class="dashboard-row">
    
    	<table class="customers-table">
         
                      <tr class="customers-table-head">
            	<td width="70px" height="30px" >رقم الوحدة / التاريخ</td>
			<?php 
			$i=1;
			for($i ; $i<=31 ; $i++ ) { 
			?>
                <td width="50px"><?php echo $i ?></td>
                
            <?php } ?>
            <td>الإجمالى</td>
            </tr>
			<?php 
			 $egmaly=0;
				$j = 0;
        foreach($aparts as $apart){
          $total = 0;
		 
        ?>
        <tr class="cell-parent">
          <td ><?php echo $apart['apart_name'] ;?></td>
         <?php 
         
         
          for ($i = 0;$i<=30;$i++)
          {
            if(!isset($prices[$j][$i]))
            {
              echo "<td></td>";
            }
            else
            {
              $total += $prices[$j][$i];
			
              echo "<td style='background:yellow;font-weight:bold;' >{$prices[$j][$i]}</td>";
            }
			
          }
		 
          ?>
          <td style='background:yellow;font-weight:bold;'><?php echo $total; ?></td>
        </tr>
		
        <?php 
		 $egmaly +=$total ;
		 
          $j++;
        } ?>
		<td colspan="30" width=""></td>
		<td class="red" colspan="4" width="">الاجمالى <?php echo $egmaly ?></td>
        </table>
		
      </div>
		<?php
          $start = $page * 20 -19;
          $end  = $start + 19;
          if($end > $totalPages)
            $end = $totalPages
          
        ?>
        <?php if(!empty($aparts)) { ?>
        <div class="clear"></div>
        <div class="relative" >
          <span class="middle xsmall showing-results absolute">عرض النتائج <?php echo $start; ?> - <?php echo $end; ?> من إجمالى <?php echo $totalPages; ?></span>
          <div id="monthly_report-selection" class="center"></div>
        </div>
        <div class="hidden totalPages"><?php if(isset($totalPages)) {echo $totalPages;} ?></div>
        <div class="hidden currentPage"><?php if(isset($page)) {echo $page;} ?></div>
        <?php } ?>
               


<div class="clear"></div>
    </div>
            